package com.cskaoyan.bean.zhao_order_bean;

import com.github.pagehelper.PageInfo;
import lombok.Data;

import java.util.List;


@Data
public class BasePageData<T> {
    Integer limit;
    Integer page;
    Integer pages;
    Integer total;
    List<T> list;


    //修改为泛型
    public static <T> BasePageData ok(List<T> list) {
        PageInfo<T> orderPageInfo = new PageInfo<>(list);

        BasePageData<T> orderBasePageData = new BasePageData<>();
        orderBasePageData.setPage(orderPageInfo.getPageNum());
        orderBasePageData.setLimit(orderPageInfo.getPageSize());
        orderBasePageData.setPages(orderPageInfo.getPages());
        orderBasePageData.setTotal((int) orderPageInfo.getTotal());
        orderBasePageData.setList(list);

        return orderBasePageData;
    }
}
